package com.gmcc.docmanager.loader;

import java.io.InputStream;

import org.apache.http.HttpResponse;

import android.text.TextUtils;

public class RandomResponseParser extends ResponseParser {

	public RandomResponseParser(ResponseListener listener) {
		super(listener);
	}

	@Override
	public void doParse(String url, HttpResponse httpresp, InputStream is,
			String postData) {
		super.doParse(url, httpresp, is, postData);

		if (netResult && rootElement != null) {
			String random = getNodeTextValue("random");
			if (TextUtils.isEmpty(random)) {
				listener.onResponse(createFailureResponse("common", 99));
			} else {
				Response response = new Response();
				response.setCode(0);
				response.setResponseObject(random);
				response(response);
			}
		}
	}

}
